<template>
  <div class="box">
    <div class="wf-top clear">
      <span> 当前城市：</span>
      <div class="wf-address">
        <select>
          <option v-for="(item, index) in option" :key="index">
            {{ item.text }}
          </option>
        </select>
      </div>
      <div class="wf-btn">
        <van-button type="default" size="mini">服务说明</van-button>
      </div>
    </div>
    <div class="img-box">
      <img
        src="https://img0.baidu.com/it/u=2912962194,1686017772&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=336"
      />
    </div>
    <div class="information-box">
      <p>维修信息</p>
      <div>
        <span>维修门店：{{ storeInformation.name }}</span>
        <div class="detail">门店详情</div>
      </div>
      <div>
        <span>门店地址：{{ storeInformation.address }}</span>
        <div class="detail">地址导航</div>
      </div>
    </div>
    <hr />
    <div class="site-box clear">
      <p>维修部位及金额</p>
      <div v-for="(itemC, indexC) in checkPart" :key="indexC">
        <span>{{ indexC + 1 }}、{{ itemC.title }}</span>
        <div class="price">￥ 1000</div>
      </div>
      <div
        v-for="(itemD, indexD) in checkDepression"
        :key="indexD + checkPart.length"
      >
        <span>{{ indexD + 1 + checkPart.length }}、{{ itemD.title }}</span>
        <div class="price">￥ 1000</div>
      </div>
      <div class="price general-price">合计：￥{{ generalPrice }}</div>
    </div>
    <div class="Way">
      <van-row justify="center" class="van-row">
        <van-col span="8">维修方式</van-col>
        <van-checkbox-group v-model="checked1" direction="horizontal">
          <van-checkbox name="1" @click="wayClick('1')" class="first-check"
            >自费维修</van-checkbox
          >
          <van-checkbox name="2" @click="wayClick('2')">保险修车</van-checkbox>
        </van-checkbox-group>
      </van-row>
      <van-row justify="center" class="van-row">
        <van-col span="8">上门接车</van-col>
        <van-checkbox-group v-model="checked2" direction="horizontal">
          <van-checkbox name="1" @click="pickClick('1')" class="first-check"
            >是</van-checkbox
          >
          <van-checkbox name="2" @click="pickClick('2')">否</van-checkbox>
        </van-checkbox-group>
      </van-row>
      <hr />
      <van-row justify="center" class="confirm">
        <van-col span="12"
          >合计：<span>299</span>
          <div class="subtotal">（接车费：￥199，定金：￥100）</div>
        </van-col>
        <van-col span="12" class="confirm-price" @click="confirm"
          >确认预约</van-col
        >
      </van-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      checked1: ["1"],
      checked2: ["1"],
      generalPrice: 0,
      storeInformation: "",
      checkPart: "",
      checkDepression: "",
      value: 0,
      option: [
        { text: "北京", value: 0 },
        { text: "成都", value: 1 },
        { text: "深圳", value: 2 },
      ],
    };
  },
  created() {
    this.storeInformation = this.$route.query.storeInformation;
    this.checkPart = this.$route.query.checkPart;
    this.checkDepression = this.$route.query.checkDepression;
    this.generalPrice =
      1000 * (this.checkPart.length + this.checkDepression.length);
  },
  methods: {
    wayClick(name) {
      this.checked1 = [name];
    },
    pickClick(name) {
      this.checked2 = [name];
    },
    confirm() {
      this.$router.push({
        path: "/payment/interface",
        query:{
          hardText:'微信支付'
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.box {
  position: relative;
  // background-color: rgb(233, 233, 233);
  .wf-top {
    // background-color: #ddd;
    span {
      float: left;
      margin-left: 10px;
      display: inline-table;
      height: 30px;
      line-height: 30px;
    }
    .wf-address {
      width: 80px;
      float: left;
      select {
        width: 60px;
        height: 30px;
        border: none;
        option {
          border: none;
        }
      }
    }
    .wf-btn {
      float: right;
      margin-right: 20px;
      height: 30px;
    }
  }
  .img-box {
    width: 100%;
    height: 220px;
    margin: 0 auto;
    background-color: rgb(230, 230, 230);
    img {
      box-sizing: border-box;
      width: 100%;
      height: 220px;
      padding: 20px;
    }
  }
  .information-box {
    width: 90%;
    margin: 10px;
    p {
      font-size: 18px;
    }

    .detail {
      float: right;
    }
  }
  .site-box {
    width: 90%;
    margin: 10px;
     padding-bottom: 100px;
    .price {
      float: right;
      padding-right: 10px;
      color: red;
    }
    .general-price {
      margin-top: 10px;
      font-size: 18px;
    }
  }
  .Way {
    background-color: white;
    position: fixed;
    bottom: 0;
    .van-row {
      width: 375px;
      text-align: center;

      .first-check {
        width: 100px;
      }
    }
    .confirm {
      height: 40px;
      .subtotal {
        font-size: 12px;
      }
      .confirm-price {
        line-height: 40px;
        height: 40px;
        border-left: 1px solid rgb(48, 48, 48);
      }
    }
  }
}
</style>